// https://iai.sh.cn/problem/52
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int change = n - 10;
  int ans = 0;
  int yu = (change % 7);
  if (change < 0)
    ans = -change;
  else {
    if (yu == 0)
      ans = change;
    else if (yu == 1)
      ans = (change / 7) * 7 + 7 - yu;
    else
      ans = (change / 7 + 1) * 7 + 7 - yu;
  }

  cout << ans;
 
  return 0;
}